<!DOCTYPE html>
<html>
<body>
    <h1>JavaScript async / await</h1>
    <p id="demo"></p>
    <script>
        function myDisplayer(some) {
            document.getElementById("demo").innerHTML = some;
        }
        async function myFunction() {
            // return "Hello";
            // return Promise.resolve("Hello");
            return Promise.reject("error");
        }
        myFunction().then(
            function (value) {
                myDisplayer(value);
            },
            function (error) {
                myDisplayer(error);
            }
        );
    </script>
</body>
</html>